Add get_cycles(), to be defined in asm/time.h, as a
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Tue, 1 Nov 2005 09:28:41 +0000 (10:28 +0100)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Tue, 1 Nov 2005 09:28:41 +0000 (10:28 +0100)
generic method to access cpu-specific local cycle counter.
Signed-off-by: Keir Fraser <keir@xensource.com>
xen/common/trace.c
xen/include/asm-x86/time.h

index 9746b75102de0292739ac77f5da13e459aac8dd6..da359b5908d481af92728423d0df4436dfe4b8aa 100644 (file)
@@ -260,7 +260,7 @@ void trace(u32 event, unsigned long d1, unsigned long d2,
     }
 
     rec = &t_recs[smp_processor_id()][buf->prod % nr_recs];
-    rdtscll(rec->cycles);
+    rec->cycles  = (u64)get_cycles();
     rec->event   = event;
     rec->data[0] = d1;
     rec->data[1] = d2;
index ba5b23139a4e5423f4f03ed8ddfdae21c1cf6138..b192f55c821ab17da1891ab1920124375211a401 100644 (file)
@@ -2,6 +2,8 @@
 #ifndef __X86_TIME_H__
 #define __X86_TIME_H__
 
+#include <asm/msr.h>
+
 extern int timer_ack;
 
 extern void calibrate_tsc_bp(void);
@@ -10,4 +12,13 @@ extern void calibrate_tsc_ap(void);
 struct domain;
 extern void init_domain_time(struct domain *d);
 
+typedef u64 cycles_t;
+
+static inline cycles_t get_cycles(void)
+{
+    cycles_t c;
+    rdtscll(c);
+    return c;
+}
+
 #endif /* __X86_TIME_H__ */